﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;

namespace Goto.UX
{
    public class UXWindow : Window
    {
        public UXWindow() {
            DefaultStyleKey = typeof(UXWindow);
            HomeWidth = HomeMaxWidth;
            this.MouseLeftButtonDown += UXWindow_MouseLeftButtonDown;
        }

        void UXWindow_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            DragMove();
        }

        #region CurrentUri
        public Uri CurrentUri
        {
            get { return GetValue(CurrentUriProperty) as Uri; }
            set { SetValue(CurrentUriProperty, value); }
        }

        public static readonly DependencyProperty CurrentUriProperty = DependencyProperty.Register(
            "CurrentUri",
            typeof(Uri),
            typeof(UXWindow),
            new PropertyMetadata());
        #endregion

        #region CornerRadius
        public CornerRadius CornerRadius
        {
            get { return (CornerRadius)GetValue(CornerRadiusProperty); }
            set { SetValue(CornerRadiusProperty, value); }
        }

        public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register(
            "CornerRadius",
            typeof(CornerRadius),
            typeof(UXWindow),
            new PropertyMetadata(new CornerRadius(0.00)));
        #endregion

        #region BlurRadius
        public double BlurRadius
        {
            get { return (double)GetValue(BlurRadiusProperty); }
            set { SetValue(BlurRadiusProperty, value); }
        }

        public static readonly DependencyProperty BlurRadiusProperty = DependencyProperty.Register(
            "BlurRadius",
            typeof(double),
            typeof(UXWindow),
            new PropertyMetadata(10.00));
        #endregion

        #region HomeMaxWidth
        public double HomeMaxWidth
        {
            get { return (double)GetValue(HomeMaxWidthProperty); }
            set { SetValue(HomeMaxWidthProperty, value); }
        }

        public static readonly DependencyProperty HomeMaxWidthProperty = DependencyProperty.Register(
            "HomeMaxWidth",
            typeof(double),
            typeof(UXWindow),
            new PropertyMetadata(500.00));
        #endregion

        #region HomeWidth
        public double HomeWidth
        {
            get { return (double)GetValue(HomeWidthProperty); }
            set { SetValue(HomeWidthProperty, value); }
        }

        public static readonly DependencyProperty HomeWidthProperty = DependencyProperty.Register(
            "HomeWidth",
            typeof(double),
            typeof(UXWindow),
            new PropertyMetadata(500.00));
        #endregion

        #region HomeMinWidth
        public double HomeMinWidth
        {
            get { return (double)GetValue(HomeMinWidthProperty); }
            set { SetValue(HomeMinWidthProperty, value); }
        }

        public static readonly DependencyProperty HomeMinWidthProperty = DependencyProperty.Register(
            "HomeMinWidth",
            typeof(double),
            typeof(UXWindow),
            new PropertyMetadata(75.00));
        #endregion

        #region UIBackground
        public Brush UIBackground
        {
            get { return GetValue(UIBackgroundProperty) as Brush; }
            set { SetValue(UIBackgroundProperty, value); }
        }

        public static readonly DependencyProperty UIBackgroundProperty = DependencyProperty.Register(
            "UIBackground",
            typeof(Brush),
            typeof(UXWindow),
            new PropertyMetadata());
        #endregion

        #region HomeBackground
        public Brush HomeBackground
        {
            get { return GetValue(HomeBackgroundProperty) as Brush; }
            set { SetValue(HomeBackgroundProperty, value); }
        }

        public static readonly DependencyProperty HomeBackgroundProperty = DependencyProperty.Register(
            "HomeBackground",
            typeof(Brush),
            typeof(UXWindow),
            new PropertyMetadata());
        #endregion

        public ICommand HomeCommand
        {
            get
            {
                return new Library.GenericCommand()
                {
                    ExecuteCallback = delegate { HomeWidth = HomeWidth == HomeMaxWidth ? HomeMinWidth : HomeMaxWidth; }
                };
            }
        }
    }
}
